Skip to content

Reconnect on wrong ports #765

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

ben-qnimble
Copy link
Contributor

This is a partial-workaround for #710.

Currently, when a user selects Board A, and Port B, when that device disconnects, the IDE searches for a 'similar' port to connect to. For reasons I don't fully appreciate 1 some boards when they disconnect and reconnect, they reconnect on a different port. So when the IDE searches for a similar port, it first searches for an exact match. But if that fails, it then searches for a match on FQBN-name pairs only and ignores the port.

Unfortunately, when the user selects Board A, then any port that isn't known to the IDE is listed with the name/FQBN of that selected board. So when the IDE is looking to reconnect, any unknown port will match based on name/FQBN. I think this may be a bug, but maybe it is desirable for reasons I don't understand and/or changing this would break things.

So as a mitigation, I've added a check to make sure that the protocol of the previously connected port matches the protocol of the new port. This doesn't fully address the problem in #710 since the serial protocol is used by 'unknown' ports as well as many Arduino devices and if the protocols match, this patch does nothing. But when using a different protocol it prevents the IE from (re)connecting to port that is not a match for the originally selected port.

Footnotes

  1. The code in boards-service-provider.ts on line 48 references the private url https://arduino.slack.com/archives/CJJHJCJSJ/p1568645417013000?thread_ts=1568640504.009400&cid=CJJHJCJSJ for why some boards disconnect and reconnect on a different port.

…eviously connected board matches the name / fqbn, also check that the protocol matches.
@CLAassistant
Copy link

CLAassistant commented Jan 22, 2022

CLA assistant check
All committers have signed the CLA.

@per1234 per1234 added topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project labels Jan 22, 2022
@per1234 per1234 assigned silvanocerza and unassigned AlbyIanna Jan 31, 2022
@silvanocerza silvanocerza deleted the branch arduino:scerza/fix-discovery-conflicts January 31, 2022 16:29
@silvanocerza
Copy link
Contributor

Sorry @ben-qnimble but could you please rebase this on top of main and change the base too? I merged the base PR so it automatically closed this one.

@ben-qnimble
Copy link
Contributor Author

Done. See #792 . Please let me know if I didn't rebase correctly or you need anything else. Thanks!

@per1234 per1234 added the conclusion: duplicate Has already been submitted label Jan 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conclusion: duplicate Has already been submitted topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants